package com.sunzn.media.library.port;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.sunzn.media.library.bean.Album;

public class AlbumViewModel extends ViewModel {

    private MutableLiveData<Album> mAlbum;

    public MutableLiveData<Album> getAlbum() {
        if (mAlbum == null) {
            mAlbum = new MutableLiveData<>();
        }
        return mAlbum;
    }

    public void setAlbum(Album album) {
        if (mAlbum != null) {
            mAlbum.setValue(album);
        }
    }

    @Override
    protected void onCleared() {
        super.onCleared();
        mAlbum = null;
    }

}